<?php

namespace services\models;

use Yii;

/**
 * This is the model class for table "tmall1.order_log".
 *
 * @property integer $order_log_id
 * @property integer $admin_uid
 * @property string $start_status
 * @property string $end_status
 * @property string $start_pay_status
 * @property string $end_pay_status
 * @property string $addtime
 * @property integer order_info_id
 * @property integer $signed_time
 */
class OrderLog extends \common\models\OrderLog
{
    public function beforeSave($insert)
    {
        if ($insert) {
            $this->addtime = date('Y-m-d H:i:s');

            $this->admin_uid = empty($this->admin_uid) ? 0 : $this->admin_uid;


        }
        return parent::beforeSave($insert);
    }

    /**
     * 取得订单信息
     * @return \yii\db\ActiveQuery
     */
    public function getOrderInfo()
    {
        return $this->hasOne(OrderInfo::className(), ['id' => $this->order_id]);
    }
}
